package ar.edu.utn.frsf.cidisi.upcolbpip2pn.generator.petrinet;

public class SubPage {
	private static int GlobalPageId = 400001;
	private static int GlobalSubpageInfoId = 500001;

	private String id;
	private String infoId;
	private String text;
	private Place transitionInput;
	private Place transitionOutput;
	private Place subnetInput;
	private Place subnetOutput;
	
	public SubPage(String text){
		GlobalPageId++;
		GlobalSubpageInfoId++;
		
		id = "ID"+GlobalPageId;
		infoId = "ID"+GlobalSubpageInfoId;
		this.text = text;
	}
	
	public SubPage(String text, Place transitionInput){
		this(text);
		
		this.transitionInput = transitionInput;
		
		transitionOutput = new Place(text);
		subnetInput = new Place(text, Place.PORT_TYPE_IN);
		subnetOutput = new Place(text, Place.PORT_TYPE_OUT);

	}

	public SubPage(String text, Place transitionInput, Place subnetInput, Place subnetOutput){
		this(text);
		
		this.transitionInput = transitionInput;
		
		transitionOutput = new Place(text+"_end");
		this.subnetInput = subnetInput;
		this.subnetOutput = subnetOutput;

	}
	
	public SubPage(String text, Place transitionInput, Place transitionOutput){
		this(text);
		
		this.transitionInput = transitionInput;
		this.transitionOutput = transitionOutput;
		subnetInput = new Place(text, Place.PORT_TYPE_IN);
		subnetOutput = new Place(text, Place.PORT_TYPE_OUT);

	}

	public SubPage(String text, Place transitionInput, String placeIdIn, String placeIdOut){
		this.text = text;
//		GlobalSubpageInfoId++;
//		infoId = "ID"+GlobalSubpageInfoId;
	
		this.transitionInput = transitionInput;
		
		transitionOutput = new Place(text);
		subnetInput = new Place(text, Place.PORT_TYPE_IN, placeIdIn);
		subnetOutput = new Place(text, Place.PORT_TYPE_OUT, placeIdOut);

	}
	
	public static void reset(){
		GlobalPageId = 400001;
		GlobalSubpageInfoId = 500001;
		
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getInfoId() {
		return infoId;
	}

	public void setInfoId(String infoId) {
		this.infoId = infoId;
	}

	public Place getTransitionInput() {
		return transitionInput;
	}

	public void setTransitionInput(Place transitionInput) {
		this.transitionInput = transitionInput;
	}

	public Place getTransitionOutput() {
		return transitionOutput;
	}

	public void setTransitionOutput(Place transitionOutput) {
		this.transitionOutput = transitionOutput;
	}

	public Place getSubnetInput() {
		return subnetInput;
	}

	public void setSubnetInput(Place subnetInput) {
		this.subnetInput = subnetInput;
	}

	public Place getSubnetOutput() {
		return subnetOutput;
	}

	public void setSubnetOutput(Place subnetOutput) {
		this.subnetOutput = subnetOutput;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}


}
